﻿Imports DevExpress.XtraPrinting

Public Class frmResultadosHistoricosPaciente
    Public RnpPaciente As String
    Private Sub frmResultadosHistoricosPaciente_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: esta línea de código carga datos en la tabla 'LabCDMDataSet.Paciente' Puede moverla o quitarla según sea necesario.
        Me.PacienteTableAdapter.Fill(Me.LabCDMDataSet.Paciente)
        If RnpPaciente <> Nothing Then
            Me.cboFiltroAnalisis.EditValue = RnpPaciente
        End If
    End Sub

    Private Sub btnFiltrar_Click(sender As Object, e As EventArgs) Handles btnFiltrar.Click
        Me.SP_MostrarResultadosXPacienteHistoricoTableAdapter.Fill(Me.LabCDMDataSet.SP_MostrarResultadosXPacienteHistorico, Me.cboFiltroAnalisis.EditValue)
    End Sub

    Private Sub cboFiltroAnalisis_EditValueChanged(sender As Object, e As EventArgs) Handles cboFiltroAnalisis.EditValueChanged
        Me.SP_MostrarResultadosXPacienteHistoricoTableAdapter.Fill(Me.LabCDMDataSet.SP_MostrarResultadosXPacienteHistorico, Me.cboFiltroAnalisis.EditValue)
    End Sub

    Private Sub btnCerrar_Click(sender As Object, e As EventArgs) Handles btnCerrar.Click
        Me.Dispose()
        Me.Close()
    End Sub

    Private Sub ExportarPDF_Click(sender As Object, e As EventArgs) Handles ExportarPDF.Click
        If sfdPDF.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcResultados
            link.Landscape = False
            link.CreateDocument()
            link.PrintingSystemBase.ExportToPdf(sfdPDF.FileName)
        End If
    End Sub

    Private Sub btnExportarExcel_Click(sender As Object, e As EventArgs) Handles btnExportarExcel.Click
        If sfdExcel.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcResultados
            link.Landscape = False
            link.CreateDocument()
            link.PrintingSystemBase.ExportToXls(sfdExcel.FileName)
        End If
    End Sub
End Class